<template>
  <div
    class="logo-container"
    :class="{
      ['logo-container-' + theme.layout]: true,
    }"
  >
    <router-link to="/">
      <span class="logo">
        <!-- 使用自定义svg示例 -->
        <!-- <vab-icon v-if="logo" :icon="logo" is-custom-svg /> -->
        <img :src="bigLogo" class="big-logo" v-show="!collapse" alt="13" />
        <img v-show="collapse" :src="smallLogo" class="small-logo" alt="12" />
      </span>
      <!-- <span
        class="title"
        :class="{ 'hidden-xs-only': theme.layout === 'horizontal' }"
      >
        {{ title }}
      </span> -->
    </router-link>
  </div>
</template>

<script>
  import bigLogo from '@/assets/image/logo_blue.png'
  import smallLogo from '@/assets/image/logo.png'
  import { mapGetters } from 'vuex'

  export default {
    name: 'VabLogo',
    computed: {
      ...mapGetters({
        collapse: 'settings/collapse',
        title: 'settings/title',
        theme: 'settings/theme',
      }),
    },
    data() {
      return {
        bigLogo,
        smallLogo,
      }
    },
  }
</script>

<style lang="scss" scoped>
  @mixin container {
    position: relative;
    height: $base-top-bar-height;
    overflow: hidden;
    line-height: $base-top-bar-height;
    background: transparent;
  }

  @mixin logo {
    display: inline-block;
    // width: 32px;
    // height: 32px;
    color: $base-title-color;
    vertical-align: middle;
  }

  @mixin title {
    display: inline-block;
    margin-left: 5px;
    overflow: hidden;
    font-size: 20px;
    line-height: 55px;
    color: $base-title-color;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  .logo-container {
    height: 100px !important;
    &-horizontal,
    &-common {
      @include container;

      .logo {
        svg,
        img {
          @include logo;
        }
      }

      .title {
        @include title;
      }
    }

    &-vertical,
    &-column,
    &-comprehensive,
    &-float {
      @include container;

      height: $base-logo-height;
      line-height: $base-logo-height;
      text-align: center;

      .logo {
        svg,
        img {
          @include logo;
        }

        .big-logo {
          position: absolute;
          top: 50%;
          left: 20px;
          width: 104px;
          height: 30px;
          opacity: 1;
          transition: all 0.2s ease 0s;
          transform: translateY(-50%);
        }

        .small-logo {
          position: absolute;
          top: 50%;
          left: 20px;
          width: 30px;
          height: 30px;
          opacity: 1;
          transition: all 0.2s ease 0s;
          transform: translateY(-50%);
        }
      }

      .title {
        @include title;
        max-width: $base-left-menu-width - 60;
      }
    }

    &-column {
      background: $base-column-second-menu-background !important;

      .logo {
        position: fixed;
        top: 0;
        display: block;
        width: $base-left-menu-width-min;
        height: $base-logo-height;
        margin: 0;
        background: $base-column-first-menu-background;
      }

      .title {
        padding-right: 15px;
        padding-left: 15px;
        margin-left: $base-left-menu-width-min !important;
        color: $base-color-black !important;
        background: $base-column-second-menu-background !important;
        @include title;
      }
    }
  }
</style>
